package org.btik.light.mobile.meta.mo;

import org.btik.light.meta.DevMo;
import org.btik.light.meta.DevState;
import org.btik.light.mobile.meta.DevPanelType;
import org.btik.light.mobile.mo.MoCreator;

import java.util.Map;

/**
 * @author lustre
 * @since 2022/12/20 15:33
 */
public class BaseMoCreator implements MoCreator,DevPanelTypeOwner {

    private DevPanelType devPanelType;

    public void setDevPanelType(DevPanelType devPanelType) {
        this.devPanelType = devPanelType;
    }

    @Override
    public DevMo create(String sn, Map<String, String> attr) {
        DefaultDevMo defaultDevMo = new DefaultDevMo(sn, DevState.CONNECTED);
        defaultDevMo.setDevPanelType(devPanelType);
        defaultDevMo.setExtendedAttributes(attr);
        return defaultDevMo;
    }

    @Override
    public DevPanelType devPanelType() {
        return devPanelType;
    }
}
